﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CRM.Entity;
using CRM.BLL;
using DP.Web.UI;
using DP.Common;


namespace CRM.Web.UserManage
{
    public partial class SetSeatID : Common.PageBase
    {
        private T_USER_BLL bll = new T_USER_BLL();

        protected override void OnInit(EventArgs e)
        {
            base.VerificationRight = false;
            base.OnInit(e);
            PageHelper.SetPrePageUrl(this.Page);

        }

        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                pageDataInit();
            }
        }

        private void pageDataInit()
        {
            string _userid = String.IsNullOrEmpty(Request.QueryString["USERID"])
                                 ? ""
                                 : Request.QueryString["USERID"].Trim();


            T_USER_Entity entity = bll.GetEntity("USERID", _userid);

            if (entity != null)
            {
                txtSEATID.Text = entity.SEATID;
            }
        }


        protected void btnOK_Click(object sender, EventArgs e)
        {
            string _userid = String.IsNullOrEmpty(Request.QueryString["USERID"])
                                 ? ""
                                 : Request.QueryString["USERID"].Trim();


            T_USER_Entity entity = bll.GetEntity("USERID", _userid);

            if (entity != null)
            {
                entity.SEATID = txtSEATID.Text.Trim();

                long rel = bll.Update(entity);
                if (rel > 0)
                {
                    PageHelper.ExecuteJS("RefreshOpener();");
                    //PageHelper.ShowMessage(this.Page, "修改成功！", "list.aspx");
                }
                else
                {
                    PageHelper.ShowMessage(this.Page, "修改失败！");
                }
            }
        }
    }
}
